<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>雄安保府酒业管理平台</title>
    <style>
        .login-box-body input{
            outline: none;
            border: 1px solid #212529;
            background-color: #fff;
            width: 268px;
            line-height: 36px;
            padding: 0 10px;
            margin-bottom: 20px;
        }
        .login-box-body button{
            outline: none;
            border: 1px solid #212529;
            background-color: #212529;
            color: #fff;
            width: 268px;
            line-height: 36px;
        }
    </style>
</head>
<body style="background-color: rgba(10,63,100,0.79)">
<div class="login-box-body">
    <div class="login-logo">
        <div align="center" style="padding-top: 200px">
            <img src="/favicon.ico" style="width: 80px; height: 80px"/>
            </br><h3>雄安保府酒业管理平台</h3>
        </div>
    </div>
    <div class="login-box-body">
        <div align="center" style="padding-top: 10px">
            <input id="account" type="text" placeholder="请输入账号"/><br/>
            <input id="password" type="password" placeholder="请输入密码"/><br/>
            <button id="loginButton">登录</button>
        </div>
    </div>
</div>
<script src="../com.js"></script>
<script type="text/javascript">
    $( document ).ready(function() {
        $('#loginButton').on('click', function () {
            $.ajax({
                url: "/back/managerLogin",
                data: {
                    "account" : $('#account').val(),
                    "password" : $('#password').val()
                },
                type: "POST",
            })
                .done(function( result ) {
                    if (result.code != 200){
                        alert(result.msg);
                    }else{
                        localStorage.removeItem("managerAccount");
                        localStorage.setItem("managerAccount", result.data.account);
                        window.location.href="/userList";
                    }
                })
                .fail(function( xhr, status, errorThrown ) {
                    alert( "Sorry, there was a problem!" );
                    console.log( "Error: " + errorThrown );
                    console.log( "Status: " + status );
                    console.dir( xhr );
                })
                .always(function( xhr, status ) {
                });
        })

        $(document).keyup(function (event) {
            if (event.keyCode == "13") {
                $.ajax({
                    url: "/back/managerLogin",
                    data: {
                        "account" : $('#account').val(),
                        "password" : $('#password').val()
                    },
                    type: "POST",
                })
                    .done(function( result ) {
                        if (result.code != 200){
                            alert(result.msg);
                        }else{
                            localStorage.removeItem("managerAccount");
                            localStorage.setItem("managerAccount", result.data.account);
                            window.location.href="/userList";
                        }
                    })
                    .fail(function( xhr, status, errorThrown ) {
                        alert( "Sorry, there was a problem!" );
                        console.log( "Error: " + errorThrown );
                        console.log( "Status: " + status );
                        console.dir( xhr );
                    })
                    .always(function( xhr, status ) {

                    });
            }
        });
    });
</script>

</body>
</html>